//
//  StoreActivityCell.m
//  LiTianDecoration
//
//  Created by zero on 2018/7/13.
//  Copyright © 2018年 administrator. All rights reserved.
//

#import "StoreActivityCell.h"
#import "SmallActivityCell.h"

@implementation StoreActivityCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}
- (void)setArray:(NSArray *)array{
    _array = array;
    _coV.delegate = self;
    _coV.dataSource = self;
    
    _flowLayout.itemSize = CGSizeMake(150, 118);
    _flowLayout.minimumLineSpacing = 10;
    _flowLayout.minimumInteritemSpacing =  0;
    _flowLayout.sectionInset = UIEdgeInsetsMake(0, 10, 0, 10);
    
    [_coV reloadData];
}

- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
    return _array.count;
}
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
    SmallActivityCell *cell = (SmallActivityCell *)[collectionView dequeueReusableCellWithReuseIdentifier:@"SmallActivity" forIndexPath:indexPath];
    cell.model  = _array[indexPath.row];
    return cell;
}
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
    if (_delegate && [_delegate respondsToSelector:@selector(CoVdidSelecItem:)]) {
        [_delegate CoVdidSelecItem:indexPath.item];
    }
}


- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
